<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Stimulus360.Controllers.Ideas.CategorizedIdeasListingViewModel>" %>

<%@ Import Namespace="Stimulus360.Models.Data" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <!-- Main Area Start -->
    <div class="main">
        <div class="contetTittle">
            <div class="floatLeft">
                <a href="javascript:void(0);" class="headerLabel"><span>
                    <%= Model.Category %></span></a>
                <%=Html.Hidden("hdnCategory", Model.Category)%>
            </div>
            <div class="floatRight">
                <a href="/Ideas/New" class="headerLabelBtn"><span>
                    &nbsp; <%= Html.Image("submitIdeas.png", "Submit Ideas") %>
                    Submit Ideas</span></a>
            </div>
        </div>
        <div id="ideaListContainer">
            <%Html.RenderPartial("IdeasList", Model.Ideas); %>
        </div>
        <div class="pagerbg">
            <div id="pagerCategorizedIdeaList" class="pager">
            </div>
        </div>
    </div>
    <!-- Main Area End -->
    <!-- Right Col Start -->
    <div class="rightCol">
        <%Html.RenderPartial("IdeaSearch"); %>
        <%Html.RenderPartial("IdeasTagCloud", Model.Categories); %>
        <%Html.RenderPartial("IdeaRSSTagCloud"); %>
    </div>
    <!-- Right Col Start -->

    <script type="text/javascript" language="javascript">
    $(document).ready(function() {
        var totalCount = "<%= Model.Ideas.TotalCount %>";

        if (totalCount == 0) {
            $(".pagerbg").hide();
        }

        var totalPages_Idea = "<%=Model.Ideas.TotalPages %>";
        if (totalPages_Idea == 1) {
            $(".pagerbg").hide();
        }
        var currentPage = "<%=Model.Ideas.PageIndex%>";
        $("#pagerCategorizedIdeaList").pager({ pagenumber: currentPage, pagecount: totalPages_Idea, buttonClickCallback: PageClick_IdeaList });
    });
    PageClick_IdeaList = function(pageclickednuber) {
    var pageIndex = pageclickednuber;
    var category = $("#hdnCategory").val();
    window.location = "/Ideas/Category/" + category + "/Page/" + pageIndex.toString();
        
    } 

//    PageClick_IdeaList = function(pageclickednumber) {
//        var pageIndex = pageclickednumber - 1;
//        var categoryId = $("#hdnCategoryId").val();
//        $.post("/Ideas/CategorizedIdeaList/" + categoryId + "/" + pageIndex, {}, function(data) {
//            $("#ideaListContainer").fadeOut("slow", function() {
//                $("#ideaListContainer").html(data);
//                reloadRating(); //***Code for Initializing rating...
//                $("#ideaListContainer").fadeIn("slow");
//            });

//            var totalPages_Idea = "<%=Model.Ideas.TotalPages %>";
//            $("#pagerCategorizedIdeaList").pager({ pagenumber: pageclickednumber, pagecount: totalPages_Idea, buttonClickCallback: PageClick_IdeaList });
//        });
//    }
    </script>

</asp:Content>
